<template>
  <div class="operate">
    <div class="List">
      <van-nav-bar title="转运操作" left-text left-arrow @click-left="onClickLeft" fixed/>
    </div>
    <div class="content1">
      <div class="shou">
        <div></div>
        <van-cell class="top">
          <template>
            <van-field label="订单名称" v-model="orderName"></van-field>
            <span class="xx">行李柜信息</span>
            <br/>
            <span class="custom-title">{{this.name}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{this.tel}}</span>
            <van-tag type="danger">默认</van-tag>
            <van-cell
              class="dz"
              :title="this.address"
              icon="location-o"
              @click="sure"
              is-link
              to="/address"
            />
          </template>
        </van-cell>
        <div class="seller">
<!--          <van-cell title="转运时间"/>-->
          <span class="van-cell">转运时间：{{this.emptyBoxCallTime}}</span>
        </div>
      </div>
      <van-button class="submit" type="primary" size="large" @click="go">提交</van-button>
    </div>
  </div>
</template>

<script>
  export default {
    mounted() {
      this.getData();
      this.getAddressData();
      console.log(this.$route.params.status);
    },
    data() {
      return {
        radio: [],
        value: 1,
        m: 0,
        name: "",
        tel: "",
        address: "",
        totalPrice: "",
        boxStandard: "",
        boxUnitPrice: "",
        list: [],
        boxlist: [],
        orderName: "",
        //totalPrice: this.value * this.radio.boxUnitPrice
        emptyBoxCallTime: this.$moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
      };
    },
    methods: {
      onClickLeft() {
        this.$router.go(-1);
      },
      sure() {
      },
      chuan(value) {
        this.boxStandard = value.boxStandard;
        this.boxUnitPrice = value.boxUnitPrice;
        this.totalPrice = value.boxUnitPrice * this.value;
        console.log(this.boxStandard);
        console.log(this.totalPrice);
      },
      two() {
        this.totalPrice = this.boxUnitPrice * this.value;
      },
      getAddressData() {
        this.$axios.get("prod-api/app/box/defaultAddress").then(res => {
          if (200 == res.data.code) {
            if (res.data.data == null) {
            } else {
              this.list = res.data.data;
              this.name = res.data.data.contacts;
              this.tel = res.data.data.contactsPhone;
              this.address = res.data.data.address;
              console.log(this.list);
            }
          }
        });
      },
      getData() {
        let paramForm = {
          id: this.$route.params.id
        };
        this.$axios
          .get("prod-api/app/order/info/" + paramForm.id, paramForm)
          .then(res => {
            if (200 == res.data.code) {
              this.list = res.data.data;
              this.orderName = res.data.data.orderName
              console.log(this.orderName)
            }
          });
      },
      go() {
        let paramForm = {};
        if (this.$route.params.operate == 3) {
          paramForm = {
            heavyBoxCallName: this.list.contacts,
            heavyBoxCallPhone: this.list.contactsPhone,
            heavyBoxCallAddress: this.list.address,
            heavyBoxOrderTime: this.emptyBoxCallTime
          };
        }
        this.$axios
          .put(
            "prod-api/app/order/operate/" +
            this.$route.params.id +
            "/" +
            this.$route.params.operate+
            "/" +
            this.$route.params.version,
            paramForm
          )
          .then(res => {
            if (200 == res.data.code) {
              this.$toast.success("操作成功");

              this.$router.go(-1);
            } else {
              this.$toast.fail("操作失败");
            }
          });
      }
    }
  };
</script>

<style lang="scss" scoped>
  body {
    margin: 0;
  }

  .operate {
    position: relative;
    background-color: #f4f5f7;
    height: 640px;

    .van-button {
      position: absolute;
      bottom: 2%;
      left: 18%;
      width: 250px;
    }

    .content {
      position: absolute;
      top: 5%;
      left: 2%;
      box-sizing: border-box;
      border-radius: 13px;
      width: 96%;
      margin: 0 auto;
      background-color: #fff;
      margin-top: 50px;
      overflow: scroll;
    }
  }

  .van-nav-bar {
    background-image: url("../assets/bg2.png");
  }

  .item {
    width: 100%;
    margin-top: 20px;
    background: #fff;
  }

  .list {
    border-bottom: 1px solid #eee;
    width: 92%;
  }

  .xinxi {
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 17px;
    font-weight: bold;
    margin-left: 15px;
  }

  .xinxi1 {
    margin-top: 10px;
    font-size: 14px;
    margin-left: 15px;
    margin-bottom: 5px;
  }

  .xinxi2 {
    font-size: 13px;
    color: dimgrey;
    margin-bottom: 10px;
  }

  .list {
    margin-left: 15px;
  }

  .seller .timeClass {
    color: #333;
  }

  .van-cell {
    font-size: 12px;
  }

  .top {
    border-top-right-radius: 20px;
    border-top-left-radius: 20px;
  }

  .shou {
    width: 90%;
    position: relative;
    margin-top: 10px;
    margin-left: 20px;
  }

  .box {
    position: relative;
    width: 90%;
    position: relative;
    margin-top: 30px;
    margin-left: 20px;

    .van-stepper {
      position: absolute;
      bottom: 10%;
      right: 20%;
    }

    .yue {
      font-size: 14px;
      bottom: 10%;
      position: absolute;
      right: 0;
    }
  }

  .van-tag {
    background-color: #227ccd;
    margin-left: 160px;
    margin-top: 19px;
  }

  .sm {
    padding-left: 23px;
  }

  .sd {
    padding-left: 23px;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
  }

  .xx {
    font-size: 14px;
    font-weight: bolder;
    padding-left: 15px;
    position: absolute;
    margin-top: 5px;
  }

  .boxxx {
    font-size: 14px;
    font-weight: bolder;
    padding-left: 15px;
    position: absolute;
    margin-top: 5px;
  }

  .custom-title {
    padding-left: 15px;
    padding-top: 15px;
    position: absolute;
    font-size: 13px;
  }

  .dz {
    color: gray;

    padding-left: 14px;
    font-size: 13px;
  }

  .listdown {
    margin-left: 80px;
    width: 200px;
  }

  .submit {
    border-radius: 20px;
    margin-top: 20px;
    background-color: #127bda;
  }

  .van-nav-bar {
    background-image: url("../assets/bg2.png");
  }

  .content1 {
    height: 100%;
    top: 10px;
    margin-top: 47px;
    position: relative;
  }

  .content {
    padding: 16px 16px 160px;
  }

  .L {
    background-color: #f4f5f7;
    height: 800px;
  }
</style>
